/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package da5221_lab1_2011;

import java.util.Arrays;

/**
 *
 * @author user
 */
public class fix {

    public int count;
    Main m = new Main();

    public fix(int[] sortHundred, int[] sortTenThousand, int[] sortMillion, int x, int[] unsortedHundred, int[] unsortedTenThousand, int[] unsortedMillion) {
        m.sortMeHundredArr = sortHundred;
        m.sortMeHundredArr = sortTenThousand;
        m.sortMeTenThousandArr = sortMillion;
        m.unSortedHundredArr = unsortedHundred;
        m.unSortedTenThousandArr = unsortedTenThousand;
        m.unSortedMillionArr = unsortedMillion;
        m.x = x;


    }

    public fix(int[] unsortedHundred, int[] unsortedTenThousand, int[] unsortedMillion, int x) {
        m.unSortedHundredArr = unsortedHundred;
        m.unSortedTenThousandArr = unsortedTenThousand;
        m.unSortedMillionArr = unsortedMillion;
        m.x = x;


    }

    public void sortHundred(int[] sortHundred) {
        Arrays.sort(sortHundred);
   
    }

    public void sortTenThousand(int[] sortTenThousand) {
        Arrays.sort(sortTenThousand);


    }

    public void sortMillion(int[] sortMillion) {
        Arrays.sort(sortMillion);


    }

    public int countOccurencesHundred(int[] sortHundred, int x) {
        count = 0;
        for (int i = 0; i < sortHundred.length; i++) {
            if (sortHundred[i] == x) {
                count++;
            }
        }
        return count;
    }

    public int countOccurencesTenthousand(int[] sortTenThousand, int x) {
        count = 0;
        for (int i = 0; i < sortTenThousand.length; i++) {
            if (sortTenThousand[i] == x) {
                count++;
            }
        }
        return count;
    }

    public int countOccurencesMillion(int[] sortMillion, int x) {
        count = 0;
        for (int i = 0; i < sortMillion.length; i++) {
            if (sortMillion[i] == x) {
                count++;
            }
        }
        return count;
    }

    public void findMinUnsortedHundred(int[] unsortedHundred) {
        sortHundred(m.unSortedHundredArr);

    }
    public void findMinUnsortedTenThousand(int[] unsortedTenThousand) {
        sortTenThousand(m.unSortedTenThousandArr);
    
    }
    public void findMinUnsortedMillion(int[] unsortedMillion) {
        
       sortMillion(m.unSortedMillionArr);
    }

    public int countOccurencesUnsortHundred(int[] unsortedHundred, int x) {
        count = 0;
        for (int i = 0; i < unsortedHundred.length; i++) {
            if (unsortedHundred[i] == x) {
                count++;
            }       
        }
        return count;
    }

    public int countOccurencesUnsortTenThousand(int[] unsortedTenThousand, int x) {
        count = 0;
        for (int i = 0; i < unsortedTenThousand.length; i++) {
            if (unsortedTenThousand[i] == x) {
                count++;
            }
        }
        return count;
    }

    public int countOccurencesUnsortMillion(int[] unsortedMillion, int x) {
        count = 0;
        for (int i = 0; i < unsortedMillion.length; i++) {
            if (unsortedMillion[i] == x) {
                count++;
            }
        }
        return count;
    }
  
}
